<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <div id="app">
        <input type="text" @keydown.enter="showInfo" />
    </div>
    <script>
        new Vue({
            el: '#app',
            methods: {
                showInfo(e) {
                    console.log(e.key, e.keyCode) // 输出：Enter 13
                    alert('按下回车键')
                }
            }
        })
    </script>
</body>
</html>